#include "umlclassheaderhighlighter.h"

UmlClassHeaderHighlighter::UmlClassHeaderHighlighter(QTextDocument *document) :
        UmlHighlighter(document)
{
    this->_stereotypeFormat.setFontWeight(QFont::Bold);
    this->_stereotypeFormat.setForeground(Qt::red);
    this->addRegex(Stereotype, "<<interface>>", true);

    this->_propertyFormat.setFontWeight(QFont::Bold);
    this->_propertyFormat.setForeground(Qt::gray);
    this->addRegex(Property, "\\{abstract\\}", true);
}

void UmlClassHeaderHighlighter::applyFormat(Type type, int index, int length)
{
    switch(type) {
    case Stereotype :
        this->setFormat(index, length, this->_stereotypeFormat);
        break;

    case Property :
        this->setFormat(index, length, this->_propertyFormat);
        break;
    }
}
